#Copyright Ken Faulkner 2007.
import sys
import wx
from wx.lib.mixins.listctrl import CheckListCtrlMixin

from Common.logRoutine import *
import traceback


#----------------------------------------------------------------------

class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin):
  def __init__(self, parent ):
    wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT)
    CheckListCtrlMixin.__init__(self)
    self.log = getLogger()
    self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)
    self.parent = parent
    self.downloadSet = set()
   
    # set the font.
    font = wx.Font(13, wx.SWISS, wx.NORMAL, wx.NORMAL)
    self.SetFont( font )

  def OnItemActivated(self, evt):
    self.ToggleItem( evt.m_itemIndex )

  # this is called by the base class when an item is checked/unchecked
  # just forward to parent.
  def OnCheckItem(self, index, flag):
    self.parent.on_check_item( index, flag )
    
